#if !defined(__MASTER_SKILL_SYSTEM_H__)
#define __MASTER_SKILL_SYSTEM_H__

#include "user.h"

enum eMasterSkillType
{
	// DK MSKILL
	AT_MSKILL_DK_CYCLONE1			= 326,
	AT_MSKILL_DK_SLASH1				= 327,
	AT_MSKILL_DK_FALLINGSLASH1		= 328,
	AT_MSKILL_DK_LUNGE1				= 329,
	AT_MSKILL_DK_TWISTINGSLASH1		= 330,
	AT_MSKILL_DK_RAGEFULBLOW1		= 331,
	AT_MSKILL_DK_TWISTINGSLASH2		= 332,
	AT_MSKILL_DK_RAGEFULBLOW2		= 333,
	AT_MSKILL_DK_DEATHSTAB1			= 336,
	AT_MSKILL_DK_DEATHSTAB2			= 339,
	AT_MSKILL_DK_DEATHSTAB3			= 342,
	AT_MSKILL_DK_DESTRUCTION1		= 337,
	AT_MSKILL_DK_DESTRUCTION2		= 340,
	AT_MSKILL_DK_BLOODSTORM			= 344,
	AT_MSKILL_DK_BLOODSTORM1		= 346,
	AT_MSKILL_DK_DESTRUCTION3		= 343,
	AT_MSKILL_DK_SWELLLIFE1			= 356,
	AT_MSKILL_DK_SWELLLIFE2			= 360,
	AT_MSKILL_DK_SWELLLIFE3			= 363,
	// DW MSKILL
	AT_MSKILL_DW_FLAME1				= 378,
	AT_MSKILL_DW_LIGHTNING1			= 379,
	AT_MSKILL_DW_EXPWIZARDRY1		= 380,
	AT_MSKILL_DW_INFERNO1			= 381,
	AT_MSKILL_DW_BLAST1				= 382,
	AT_MSKILL_DW_EXPWIZARDRY2		= 383,
	AT_MSKILL_DW_POISON1			= 384,
	AT_MSKILL_DW_EVILSPIRIT1		= 385,
	AT_MSKILL_DW_DECAY1				= 387,
	AT_MSKILL_DW_HELLFIRE1			= 388,
	AT_MSKILL_DW_ICE1				= 389,
	AT_MSKILL_DW_METEORIT1			= 390,
	AT_MSKILL_DW_ICESTORM1			= 391,
	AT_MSKILL_DW_NOVA1				= 392,
	AT_MSKILL_DW_ICESTORM2			= 393,
	AT_MSKILL_DW_METEORIT2			= 394,
	AT_MSKILL_DW_MANASHIELD1		= 403,
	AT_MSKILL_DW_MANASHIELD2		= 404,
	AT_MSKILL_DW_MANASHIELD3		= 406,
	AT_MSKILL_DW_EARTHPRISON		= 495,
	AT_MSKILL_DW_EARTHPRISON1		= 497,
	// FE MSKILL
	AT_MSKILL_FE_HEAL1				= 413,
	AT_MSKILL_FE_TRIPLESHOT1		= 414,
	AT_MSKILL_FE_PENETRATION1		= 416,
	AT_MSKILL_FE_DEFENSEBUFF1		= 417,
	AT_MSKILL_FE_TRIPLESHOT2		= 418,
	AT_MSKILL_FE_ATTACKBUFF1		= 420,
	AT_MSKILL_FE_ATTACKBUFF2		= 422,
	AT_MSKILL_FE_DEFENSEBUFF2		= 423,
	AT_MSKILL_FE_ICEARROW1			= 424,
	AT_MSKILL_FE_CURE				= 425,
	AT_MSKILL_FE_PARTYHEAL			= 426,
	AT_MSKILL_FE_PARTYHEAL1			= 429,
	AT_MSKILL_FE_POISONARROW		= 427,
	AT_MSKILL_FE_POISONARROW1		= 434,
	AT_MSKILL_FE_BLESS				= 430,
	AT_MSKILL_FE_BLESS1				= 433,
	AT_MSKILL_FE_MULTISHOT1			= 411,
	AT_MSKILL_FE_MULTISHOT2			= 431,
	AT_MSKILL_FE_SUMMONSATYROS		= 432,
	AT_MSKILL_FE_INFINITY1			= 441,
	// SUM MSKILL
	AT_MSKILL_SUM_SLEEP1			= 454,
	AT_MSKILL_SUM_CHAINLIGHTNING1	= 455,
	AT_MSKILL_SUM_LIGHTNSHOCK1		= 456,
	AT_MSKILL_SUM_DRAINLIFE1		= 458,
	AT_MSKILL_SUM_DRAINLIFE2		= 462,
	AT_MSKILL_SUM_WEAKNESS1			= 459,
	AT_MSKILL_SUM_INNOVATION1		= 460,
	AT_MSKILL_SUM_BLIND				= 461,
	AT_MSKILL_SUM_BLIND1			= 463,
	AT_MSKILL_SUM_BERSERK1			= 469,
	AT_MSKILL_SUM_BERSERK2			= 470,
	AT_MSKILL_SUM_BERSERK3			= 472,
	// MG MSKILL
	AT_MSKILL_MG_CYCLONE1			= 479,
	AT_MSKILL_MG_LIGHTNING1			= 480,
	AT_MSKILL_MG_TWISTINGSLASH1		= 481,
	AT_MSKILL_MG_POWERSLASH1		= 482,
	AT_MSKILL_MG_FLAME1				= 483,
	AT_MSKILL_MG_BLAST1				= 484,
	AT_MSKILL_MG_INFERNO1			= 486,
	AT_MSKILL_MG_EVILSPIRIT1		= 487,
	AT_MSKILL_MG_ICE1				= 489,
	AT_MSKILL_MG_ICE2				= 491,
	AT_MSKILL_MG_FIRESLASH1			= 490,
	AT_MSKILL_MG_FIRESLASH2			= 493,
	AT_MSKILL_MG_FLAMESTRIKE1		= 492,
	AT_MSKILL_MG_FLAMESTRIKE2		= 494,
	AT_MSKILL_MG_GIGANTICSTORM1		= 496,
	// DL MSKILL
	AT_MSKILL_DL_FIREBURST1			= 508,
	AT_MSKILL_DL_FORCEWAVE1			= 509,
	AT_MSKILL_DL_CRITICALDAMAGE1	= 511,
	AT_MSKILL_DL_EARTHSHAKE1		= 512,
	AT_MSKILL_DL_FIREBURST2			= 514,
	AT_MSKILL_DL_CRITICALDAMAGE2	= 515,
	AT_MSKILL_DL_EARTHSHAKE2		= 516,
	AT_MSKILL_DL_CRITICALDAMAGE3	= 517,
	AT_MSKILL_DL_FIRESCREAM1		= 518,
	AT_MSKILL_DL_ELECTRICSPARK1		= 519,
	AT_MSKILL_DL_FIRESCREAM2		= 520,
	AT_MSKILL_DL_IRONDEFENSE		= 521,
	AT_MSKILL_DL_IRONDEFENSE1		= 524,
	AT_MSKILL_DL_CRITICALDAMAGE4	= 522,
	AT_MSKILL_DL_CHAOTICDESEAR1		= 523,
	// RF SKILL
	AT_MSKILL_RF_KILLBLOW1			= 551,
	AT_MSKILL_RF_KILLBLOW2			= 554,
	AT_MSKILL_RF_UPERCUT1			= 552,
	AT_MSKILL_RF_UPERCUT2			= 555,
	AT_MSKILL_RF_CHAINDRIVE1		= 558,
	AT_MSKILL_RF_CHAINDRIVE2		= 562,
	AT_MSKILL_RF_DARKSIDE1			= 559,
	AT_MSKILL_RF_DARKSIDE2			= 563,
	AT_MSKILL_RF_DRAGONRORE1		= 560,
	AT_MSKILL_RF_DRAGONRORE2		= 561,
	AT_MSKILL_RF_DRAGONSLASH1		= 564,
	AT_MSKILL_RF_DRAGONSLASH2		= 565,
	AT_MSKILL_RF_DEFRATE1			= 569,
	AT_MSKILL_RF_DEFRATE2			= 572,
	AT_MSKILL_RF_FITNESS1			= 573,
};

#if( __4GAMERS__ == 1 )
#define MAX_MASTER_LEVEL	400
#else
#define MAX_MASTER_LEVEL	330
#endif

class CMasterExperience
{
public:
	CMasterExperience();
	virtual ~CMasterExperience();

	void Init();
	void LoadInfo();

	void SetExpTable();
	void SetNextExp(LPOBJ lpObj);
	int LevelUp(LPOBJ lpObj,__int64 AddExp);
	int IsEnabled(LPOBJ lpObj);
	int CheckMonsterLvl(LPOBJ lpObj,LPOBJ lpNpc);
	void LevelUpSend(LPOBJ lpObj);

	__int64 GetMaxExp(int Level);
	int GetDecExp(LPOBJ lpObj);
	int GetSubMoney(LPOBJ lpObj);
	void DGReqMasterInfo(LPOBJ lpObj);
	void GDAnsMasterInfo(LPBYTE aRecv);
	void SaveMasterInfo(LPOBJ lpObj);
	void SendMasterInfo(LPOBJ lpObj);

// Variables

	//__int64 m_ExpTable[MAX_MASTER_LEVEL+1];
	std::vector<__int64> m_ExpTable;

	float m_AddExp;

private:
	int m_MaxLevel;
	int m_MinReset;
	BYTE m_Mode;
	short m_MinMonsterLevel;
	short m_MaxMonsterLevel;
	std::vector<short> m_MapList;
	std::vector<short> m_MonsterList;
	
};

extern CMasterExperience g_MasterExp;

#endif